package com.tanglongan.designPattern.dp09_decorator.demo01;

public class Client {

    public static void main(String[] args) {
        Battercake battercake;

        //买一个煎饼
        battercake = new BaseBattercake();
        //加一个鸡蛋
        battercake = new EggDecorator(battercake);
        //再加一个鸡蛋
        battercake = new EggDecorator(battercake);
        //非常饿了，再加一个香肠
        battercake = new SausageDecorator(battercake);

        //与静态代理的最大区别就是职责不同
        //1、静态代理不一定要满足is-a的关系
        //2、静态代理会做功能增强，同一个职责变得不一样
        // 装饰器更多考虑的是扩展
        System.out.println(battercake.getMsg() + "，总价格：" + battercake.getPrice());
    }
}
